class_name AnimationComponent_Weapon
extends AnimationComponent

#region 属性
var weapon:Weapon
var weapon_data:EntityData_Weapon
var connect_obj_dict:Dictionary = {}
var enable:bool = false
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
#endregion
#region 公共方法
func init_component(args:Dictionary = {}):
	super(args)
	self.weapon = args.get("Weapon")
	self.weapon_data = self.weapon.get_weapon_data()
	connect_obj_dict["WeaponStateChanged"] = ConnectObj.new(weapon.weapon_state_changed,[on_weapon_state_changed])
	inited = true
func obtain(entity:Entity):
	pass
func discard():
	pass
func restore_pickable():
	pass
func equip():
	pass
func unequip():
	pass
func destroy():
	for connect_obj:ConnectObj in connect_obj_dict.values():
		connect_obj.disconnect_all()
func on_weapon_state_changed(last_weapon_state:GameEnum.WeaponState,cur_weapon_state:GameEnum.WeaponState):
	match cur_weapon_state:
		GameEnum.WeaponState.UnPickable:
			discard()
		GameEnum.WeaponState.Pickable:
			restore_pickable()
		GameEnum.WeaponState.Obtain:
			obtain(weapon.get_weapon_entity())
		GameEnum.WeaponState.UnEquip:
			unequip()
		GameEnum.WeaponState.Equip:
			equip()
		GameEnum.WeaponState.Destroy:
			destroy()
		_:
			pass
func get_connect_obj_dict() -> Dictionary:
	return connect_obj_dict
func set_enable(enable):
	if self.enable != enable:
		self.enable = enable
#endregion
#region 私有方法
#endregion
#region 生命周期函数
#endregion
